package com.wlyuan.index.domain.source.valueobj;

import com.wlyuan.core.domain.valueobj.QuotationId;
import com.wlyuan.core.domain.valueobj.TemplateId;
import com.wlyuan.core.named.TransportMode;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

import java.math.BigDecimal;

@AllArgsConstructor
@Builder
@Getter
@ToString
public final class Quote {
    @ApiModelProperty("合约模板ID")
    private TemplateId templateId;

    @ApiModelProperty("报价单ID")
    private QuotationId quotationId;

    @ApiModelProperty("运输模式")
    private TransportMode transportMode;

    @ApiModelProperty("运费")
    private BigDecimal divideFee;
    private BigDecimal wholeFee;

    @ApiModelProperty("提货费")
    private BigDecimal pickFee;

    @ApiModelProperty("送货费")
    private BigDecimal deliverFee;

    @ApiModelProperty("装货费")
    private BigDecimal loadFee;

    @ApiModelProperty("卸货费")
    private BigDecimal unloadFee;

    @ApiModelProperty("保险费")
    private BigDecimal insureFee;

    @ApiModelProperty("税费")
    private BigDecimal taxFee;

    @ApiModelProperty("附加费")
    private BigDecimal surchargeFee;

    @ApiModelProperty("预付款")
    private BigDecimal prepayFee;

    @ApiModelProperty("货到付款")
    private BigDecimal arrivePayFee;

    @ApiModelProperty("代收货款")
    private BigDecimal collectionFee;

    @ApiModelProperty("回执费用")
    private BigDecimal receiptFee;

    @ApiModelProperty("异常费")
    private BigDecimal exceptionFee;

    @ApiModelProperty("总费用")
    private BigDecimal totalFee;

    @ApiModelProperty("最小费用")
    private BigDecimal minimumFee;

    @ApiModelProperty("是否重算：1是，0否")
    private boolean recalculated;

    public BigDecimal getTransportFee() {
        if (TransportMode.WHOLE == transportMode) {
            return this.wholeFee;
        }
        return this.divideFee;
    }
}
